home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 13 April 1997
- // Author: gf
- //
- //
- // Procedure Name:
- // DynCreateFluidsMenu
- //
- // Description:
- // Create the DYNAMICS->Fluids menu
- //
- // Input Arguments:
- // parent to parent the menu to.
- //
- // Return Value:
- // None.
- //
-
-
- global proc DynCreateFluidsMenu( string $parent )
- {
- setParent -menu $parent;
- if( `menu -query -numberOfItems $parent` != 0 ) {
- //
- // Menu is built already - just return
- //
- return;
- }
-
- menuItem -label "Create 3D Container"
- -annotation (getRunTimeCommandAnnotation("Create3DContainer"))
- -image "fluidCreate3D.xpm"
- -command "Create3DContainer"
- -dragMenuCommand "performFluids 1 Create3DFluid 2"
- -dragDoubleClickCommand "Create3DContainerOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("Create3DContainerOptions"))
- -command "Create3DContainerOptions";
-
- menuItem -label "Create 2D Container"
- -annotation (getRunTimeCommandAnnotation("Create2DContainer"))
- -image "fluidCreate2D.xpm"
- -command "Create2DContainer"
- -dragMenuCommand "performFluids 1 Create2DFluid 2"
- -dragDoubleClickCommand "Create2DContainerOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("Create2DContainerOptions"))
- -command "Create2DContainerOptions";
-
- // Contents
- string $contentsItem = `menuItem -label "Add/Edit Contents" -subMenu true
- -tearOff true -allowOptionBoxes true fluidsAddContentsItem`;
- FluidContentsMenu $contentsItem;
- setParent -menu ..;
-
- menuItem -label "Create 3D Container with Emitter"
- -annotation (getRunTimeCommandAnnotation("Create3DContainerEmitter"))
- -image "fluidCreate3DEmitter.xpm"
- -command "Create3DContainerEmitter"
- -dragMenuCommand "performFluids 1 3DFluidAndEmitter 2"
- -dragDoubleClickCommand "Create3DContainerEmitterOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("Create3DContainerEmitterOptions"))
- -command "Create3DContainerEmitterOptions";
-
- menuItem -label "Create 2D Container with Emitter"
- -annotation (getRunTimeCommandAnnotation("Create2DContainerEmitter"))
- -image "fluidCreate2DEmitter.xpm"
- -command "Create2DContainerEmitter"
- -dragMenuCommand "performFluids 1 2DFluidAndEmitter 2"
- -dragDoubleClickCommand "Create2DContainerEmitterOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("Create2DContainerEmitterOptions"))
- -command "Create2DContainerEmitterOptions";
-
- menuItem -divider true;
-
- menuItem -label "Get Fluid Example..."
- -annotation (getRunTimeCommandAnnotation("GetFluidExample"))
- -image "fluidGetExamples.xpm"
- -command "GetFluidExample";
-
- setParent -menu ..;
-
- menuItem -label "Get Ocean/Pond Example..."
- -annotation (getRunTimeCommandAnnotation("GetOceanPondExample"))
- -image "fluidOceanPresets.xpm"
- -command "GetOceanPondExample";
-
- setParent -menu ..;
-
- menuItem -label "Fluid Examples on the Web..."
- -annotation (getRunTimeCommandAnnotation("FluidExamplesOnTheWeb"))
- -image "fluidGetWebExamples.xpm"
- -command ( "FluidExamplesOnTheWeb" );
-
- setParent -menu ..;
-
- menuItem -divider true;
-
- // Ocean
- string $oceanItem = `menuItem -label "Ocean" -subMenu true
- -tearOff true -allowOptionBoxes true`;
- FluidOceanMenu $oceanItem;
- setParent -menu ..;
-
- menuItem -divider true;
-
- // Pond
- string $pondItem = `menuItem -label "Pond" -subMenu true
- -tearOff true -allowOptionBoxes true`;
- FluidPondMenu $pondItem;
- setParent -menu ..;
-
- menuItem -divider true;
-
- menuItem -label "Extend Fluid"
- -annotation (getRunTimeCommandAnnotation("ExtendFluid"))
- -image "fluidExtend.xpm"
- -command "ExtendFluid"
- -dragMenuCommand "performFluids 1 ExtendFluid 2"
- -dragDoubleClickCommand "ExtendFluidOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("ExtendFluidOptions"))
- -command "ExtendFluidOptions";
-
- menuItem -label "Edit Fluid Resolution"
- -annotation (getRunTimeCommandAnnotation("EditFluidResolution"))
- -image "fluidEditRes.xpm"
- -command "EditFluidResolution"
- -dragMenuCommand "performFluids 1 ResampleFluid 2"
- -dragDoubleClickCommand "EditFluidResolutionOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("EditFluidResolutionOptions"))
- -command "EditFluidResolutionOptions";
-
- menuItem -label "Make Collide"
- -annotation (getRunTimeCommandAnnotation("MakeFluidCollide"))
- -image "fluidCollide.xpm"
- -command "MakeFluidCollide"
- -dragMenuCommand "performFluids 2 MakeCollideFluid 2"
- -dragDoubleClickCommand "MakeFluidCollideOptions";
-
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("MakeFluidCollideOptions"))
- -command "MakeFluidCollideOptions";
-
- menuItem -label "Make Motion Field"
- -annotation (getRunTimeCommandAnnotation("MakeMotionField"))
- -command "MakeMotionField" ;
-
- menuItem -divider true;
-
- menuItem -label "Set Initial State"
- -annotation (getRunTimeCommandAnnotation("SetInitialState"))
- -image "fluidInitialStateSet.xpm"
- -command "SetInitialState"
- -dragMenuCommand "performSetFluidState 2"
- -dragDoubleClickCommand "SetInitialStateOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("SetInitialStateOptions"))
- -command "SetInitialStateOptions";
-
- menuItem -label "Clear Initial State"
- -annotation (getRunTimeCommandAnnotation("ClearInitialState"))
- -image "fluidInitialStateClear.xpm"
- -command "ClearInitialState" ;
-
- menuItem -label "Save State As..."
- -annotation (getRunTimeCommandAnnotation("SaveFluidStateAs"))
- -command "SaveFluidStateAs";
-
- menuItem -label "Create Cache"
- -annotation (getRunTimeCommandAnnotation("CreateFluidCache"))
- -image "fluidCacheCreate.xpm"
- -command "CreateFluidCache"
- -dragMenuCommand "performFluidsDiskCache 2 mcfp"
- -dragDoubleClickCommand "CreateFluidCacheOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("CreateFluidCacheOptions"))
- -command "CreateFluidCacheOptions";
-
- menuItem -label "Append to Cache"
- -annotation (getRunTimeCommandAnnotation("AppendToFluidCache"))
- -image "fluidCacheAppend.xpm"
- -command "AppendToFluidCache"
- -dragMenuCommand "performAppendDiskCache 2"
- -dragDoubleClickCommand "AppendToFluidCacheOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("AppendToFluidCacheOptions"))
- -command "AppendToFluidCacheOptions";
-
- menuItem -label "Truncate Cache"
- -annotation (getRunTimeCommandAnnotation("TruncateFluidCache"))
- -image "fluidCacheTruncate.xpm"
- -command "TruncateFluidCache";
-
- menuItem -label "Delete Cache"
- -annotation (getRunTimeCommandAnnotation("DeleteFluidCache"))
- -image "fluidCacheDelete.xpm"
- -command "DeleteFluidCache";
- }
-
- global proc FluidContentsMenu( string $parent )
- //
- // Build the Add Contents Submenu
- {
- setParent -menu $parent;
-
- menuItem -label "Emitter"
- -annotation (getRunTimeCommandAnnotation("FluidEmitter"))
- -image "fluidEmitterAdd.xpm"
- -command "FluidEmitter"
- -dragMenuCommand "performFluids 2 FluidEmitter 2"
- -dragDoubleClickCommand "FluidEmitterOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("FluidEmitterOptions"))
- -command "FluidEmitterOptions";
-
- menuItem -label "Emit from Object"
- -annotation (getRunTimeCommandAnnotation("EmitFluidFromObject"))
- -image "fluidObjectEmit.xpm"
- -command "EmitFluidFromObject"
- -dragMenuCommand "performFluids 0 FluidEmitFromObject 2"
- -dragDoubleClickCommand "EmitFluidFromObjectOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("EmitFluidFromObjectOptions"))
- -command "EmitFluidFromObjectOptions";
-
- menuItem -label "Gradients"
- -annotation (getRunTimeCommandAnnotation("FluidGradients"))
- // -image "fluidGradients.xpm"
- -command "FluidGradients"
- -dragMenuCommand "performFluidGradients 2"
- -dragDoubleClickCommand "FluidGradientsOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("FluidGradientsOptions"))
- -command "FluidGradientsOptions";
-
- menuItem -label "Paint Fluids Tool"
- -annotation (getRunTimeCommandAnnotation("PaintFluidsTool"))
- -image "fluidPaint.xpm"
- -command "PaintFluidsTool"
- -dragDoubleClickCommand "PaintFluidsToolOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("PaintFluidsToolOptions"))
- -command "PaintFluidsToolOptions";
-
- menuItem -label "With Curve"
- -annotation (getRunTimeCommandAnnotation("SetFluidAttrFromCurve"))
- // -image ""
- -command "SetFluidAttrFromCurve"
- -dragDoubleClickCommand "SetFluidAttrFromCurveOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("SetFluidAttrFromCurveOptions"))
- -command "SetFluidAttrFromCurveOptions";
-
- menuItem -label "Initial States..."
- -image "fluidGetInitialStatePresets.xpm"
- -annotation (getRunTimeCommandAnnotation( "InitialFluidStates"))
- -command "InitialFluidStates";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation( "InitialFluidStatesOptions"))
- -command "InitialFluidStatesOptions";
-
- setParent -menu ..;
- }
-
- global proc fluidSetSubVolumeLocation( int $relAmount )
- //
- // Description:
- // Increase the center slice location of the fluid subvolume
- // by the relative amount passed in.
- //
- {
- if( !`exists getActiveFluidShapes` ) {
- source "getFluidShape.mel";
- }
-
- string $fluids[] = getActiveFluidShapes();
- if( size( $fluids ) == 0 ) {
- error( "No fluids selected" );
- }
-
-
- for( $f in $fluids ) {
- if( `getAttr ($f + ".is2d")` ) {
- warning( "Cannot set sub-volume location on 2d fluids" );
- continue;
- }
-
- // If not displaying a subvolume, issue a warning that you
- // won't see any effect... (But don't prevent it -- you might
- // want to see the manipulator slice move around?)
- //
- if( `getAttr ($f + ".dsv" )` == 0 ) {
- warning( $f + " is not displaying a sub-volume. Use the " +
- "Fluid Sub-Volume Tool to turn on display and " +
- "modify the size of a sub-volume." );
- }
-
- int $axis = 0;
- float $center[] = `getAttr ($f + ".svc")`;
- for( $i = 0; $i <= 2; $i++ ) {
- if( $center[$i] != -1 ) {
- $axis = $i;
- break;
- }
- }
-
- $center[$axis] = $center[$axis] + $relAmount;
-
- float $dim[] = `getAttr ($f + ".resolution")`;
- if( $center[$axis] >= $dim[$axis] ) {
- error( "Location cannot be greater than fluid resolution.");
- } else if( $center[$axis] < 0 ) {
- error( "Location cannot be less than 0.");
- } else {
- setAttr ($f + ".svc") $center[0] $center[1] $center[2];
- }
- }
- }
-
- global proc FluidOceanMenu( string $parent )
- //
- // Build the Ocean Submenu
- {
- setParent -menu $parent;
-
- menuItem -label "Create Ocean"
- -annotation (getRunTimeCommandAnnotation("CreateOcean"))
- -image "fluidCreateOcean.xpm"
- -command "CreateOcean"
- -dragMenuCommand "performCreateOcean 2"
- -dragDoubleClickCommand "CreateOceanOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("CreateOceanOptions"))
- -command "CreateOceanOptions";
-
- menuItem -label "Add Preview Plane"
- -annotation (getRunTimeCommandAnnotation("AddOceanPreviewPlane"))
- -image "fluidaddOceanPreviewPlane.xpm"
- -command "AddOceanPreviewPlane";
-
- menuItem -label "Create Wake"
- -annotation (getRunTimeCommandAnnotation("CreateOceanWake"))
- -image "fluidaddOceanPreviewPlane.xpm"
- -command "CreateOceanWake"
- -dragMenuCommand "performCreateOceanWake 2"
- -dragDoubleClickCommand "CreateOceanWakeOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("CreateOceanWakeOptions"))
- -command "CreateOceanWakeOptions";
-
- menuItem -label "Add Ocean Surface Locator"
- -annotation (getRunTimeCommandAnnotation("AddOceanSurfaceLocator"))
- -image "fluidaddOceanLocator.xpm"
- -command "AddOceanSurfaceLocator";
-
- menuItem -label "Add Dynamic Locator"
- -annotation (getRunTimeCommandAnnotation("AddOceanDynamicLocator"))
- -command "AddOceanDynamicLocator"
- -dragMenuCommand "performOceanLocator 2 1"
- -dragDoubleClickCommand "AddOceanDynamicLocatorOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("AddOceanDynamicLocatorOption"))
- -command "AddOceanDynamicLocatorOptions";
-
- menuItem -label "Add Boat Locator"
- -annotation (getRunTimeCommandAnnotation("AddBoatLocator"))
- -command "AddBoatLocator"
- -dragMenuCommand "performOceanLocator 2 3"
- -dragDoubleClickCommand "AddBoatLocatorOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("AddBoatLocatorOptions"))
- -command "AddBoatLocatorOptions";
-
- menuItem -label "Add Dynamic Buoy"
- -annotation (getRunTimeCommandAnnotation("AddDynamicBuoy"))
- -command "AddDynamicBuoy"
- -dragMenuCommand "performOceanLocator 2 2"
- -dragDoubleClickCommand "AddDynamicBuoyOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("AddDynamicBuoyOptions"))
- -command "AddDynamicBuoyOptions";
-
- menuItem -label "Float Selected Objects"
- -annotation (getRunTimeCommandAnnotation("FloatSelectedObjects"))
- -command "FloatSelectedObjects"
- -dragMenuCommand "performOceanLocator 2 4"
- -dragDoubleClickCommand "FloatSelectedObjectsOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("FloatSelectedObjectsOptions"))
- -command "FloatSelectedObjectsOptions";
-
- menuItem -label "Make Boats"
- -annotation (getRunTimeCommandAnnotation("MakeBoats"))
- -command "MakeBoats"
- -dragMenuCommand "performOceanLocator 2 5"
- -dragDoubleClickCommand "MakeBoatsOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("MakeBoatsOptions"))
- -command "MakeBoatsOptions";
-
- menuItem -label "Make Motor Boats"
- -annotation (getRunTimeCommandAnnotation("MakeMotorBoats"))
- -image "fluidOceanMotorBoats.xpm"
- -command "MakeMotorBoats"
- -dragMenuCommand "performOceanLocator 2 6"
- -dragDoubleClickCommand "MakeMotorBoatsOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("MakeMotorBoatsOptions"))
- -command "MakeMotorBoatsOptions";
-
- setParent -menu ..;
- }
-
- global proc FluidPondMenu( string $parent )
- //
- // Build the Pond Submenu
- {
- setParent -menu $parent;
-
- menuItem -label "Create Pond"
- -annotation (getRunTimeCommandAnnotation("CreatePond"))
- -image "fluidCreatePond.xpm"
- -command "CreatePond"
- -dragMenuCommand "performCreatePond 2"
- -dragDoubleClickCommand "CreatePondOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("CreatePondOptions"))
- -command "CreatePondOptions";
-
- menuItem -label "Create Wake"
- -annotation (getRunTimeCommandAnnotation("CreateWake"))
- -command "CreateWake"
- -dragMenuCommand "performCreateWake 2"
- -dragDoubleClickCommand "CreateWakeOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("CreateWakeOptions"))
- -command "CreateWakeOptions";
-
- menuItem -label "Add Pond Surface Locator"
- -annotation (getRunTimeCommandAnnotation("AddPondSurfaceLocator"))
- -image "fluidaddOceanLocator.xpm"
- -command "AddPondSurfaceLocator";
-
- menuItem -label "Add Dynamic Locator"
- -annotation (getRunTimeCommandAnnotation("AddPondDynamicLocator"))
- -command "AddPondDynamicLocator"
- -dragMenuCommand "performPondLocator 2 1"
- -dragDoubleClickCommand "AddPondDynamicLocatorOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("AddPondDynamicLocatorOption"))
- -command "AddPondDynamicLocatorOptions";
-
- menuItem -label "Add Boat Locator"
- -annotation (getRunTimeCommandAnnotation("AddBoatLocator"))
- -command "AddPondBoatLocator"
- -dragMenuCommand "performPondLocator 2 3"
- -dragDoubleClickCommand "AddPondBoatLocatorOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("AddBoatLocatorOptions"))
- -command "AddPondBoatLocatorOptions";
-
- menuItem -label "Add Dynamic Buoy"
- -annotation (getRunTimeCommandAnnotation("AddDynamicBuoy"))
- -command "AddPondDynamicBuoy"
- -dragMenuCommand "performPondLocator 2 2"
- -dragDoubleClickCommand "AddPondDynamicBuoyOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("AddDynamicBuoyOptions"))
- -command "AddPondDynamicBuoyOptions";
-
- menuItem -label "Float Selected Objects"
- -annotation (getRunTimeCommandAnnotation("FloatSelectedObjects"))
- -command "FloatSelectedPondObjects"
- -dragMenuCommand "performPondLocator 2 4"
- -dragDoubleClickCommand "FloatSelectedPondObjectsOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("FloatSelectedObjectsOptions"))
- -command "FloatSelectedPondObjectsOptions";
-
- menuItem -label "Make Boats"
- -annotation (getRunTimeCommandAnnotation("MakeBoats"))
- -command "MakePondBoats"
- -dragMenuCommand "performPondLocator 2 5"
- -dragDoubleClickCommand "MakePondBoatsOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("MakeBoatsOptions"))
- -command "MakePondBoatsOptions";
-
- menuItem -label "Make Motor Boats"
- -annotation (getRunTimeCommandAnnotation("MakeMotorBoats"))
- -image "fluidOceanMotorBoats.xpm"
- -command "MakePondMotorBoats"
- -dragMenuCommand "performPondLocator 2 6"
- -dragDoubleClickCommand "MakePondMotorBoatsOptions";
-
- menuItem -optionBox true
- -annotation (getRunTimeCommandAnnotation("MakeMotorBoatsOptions"))
- -command "MakePondMotorBoatsOptions";
-
- setParent -menu ..;
- }
-
-